package org.carabiner.infinitest.depgraph;

import org.carabiner.infinitest.FilterList;

public class RegexVerifier implements TestVerifier
{
  private FilterList filters;
  private TestVerifier testCaseVerifier;

  public RegexVerifier(FilterList filterList)
  {
    filters = filterList;
    testCaseVerifier = new TestCaseVerifier();
  }

  public boolean isATest(Class clazz)
  {
    if (!testCaseVerifier.isATest(clazz))
    {
      return false;
    }
    if (filters.match(clazz.getName()))
    {
      return false;
    }
    return true;
  }

  public boolean isFiltered(String name)
  {
    return filters.match(name);
  }
}
